

const KEY_TOKEN = "KT_DIANDIAN";
const KEY_RESULT_ID = "RES_ID_DIANDIAN";
const KEY_ACCOUNT = "AC_DIANDIAN";
const KEY_PASSWORD = "PWD_DIANDIAN";


export const setAccountCache = info => {
    try {
        const cached = info || ""
        localStorage.setItem(KEY_ACCOUNT, cached);
    } catch (e) {
    }
}

export const getAccountCache = () => {
    try {
        const cached = localStorage.getItem(KEY_ACCOUNT) || ""
        return cached;
    } catch (e) {
    }
    return "";
}

export const setPasswordCache = info => {
    try {
        const cached = info || ""
        localStorage.setItem(KEY_PASSWORD, cached);
    } catch (e) {
    }
}

export const getPasswordCache = () => {
    try {
        const cached = localStorage.getItem(KEY_PASSWORD) || ""
        return cached;
    } catch (e) {
    }
    return "";
}

export const setTokenCache = info => {
    try {
        const cached = info || ""
        localStorage.setItem(KEY_TOKEN, cached);
    } catch (e) {
    }
}

export const getTokenCache = () => {
    try {
        const cached = localStorage.getItem(KEY_TOKEN) || ""
        return cached;
    } catch (e) {
    }
    return "";
}

export const setResultIdCache = info => {
    try {
        const cached = info || ""
        localStorage.setItem(KEY_RESULT_ID, cached);
    } catch (e) {
    }
}

export const getResultIdCache = () => {
    try {
        const cached = localStorage.getItem(KEY_RESULT_ID) || ""
        return cached;
    } catch (e) {
    }
    return "";
}
